#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time       :   10:55
# Author     : Y4
# Site       : 获取 前台用户信息
# File       : get_client_user.py

from App.models.client import User


def get_user(user_ident):
    if not user_ident:
        return None

    # 根据uuid
    user = User.query.filter(User.uuid == user_ident).first()
    if user:
        return user

    # 根据用户名
    user = User.query.filter(User.username == user_ident).first()
    if user:
        return user

    # 根据手机
    user = User.query.filter(User.phone == user_ident).first()
    if user:
        return user

    return None
